package com.goldgov.utils;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class PropertyUtil {
	/**
	 * 检验传入对象是否为空
	 * 
	 * @param obj
	 * @return
	 */
	public static boolean objectNotEmpty(Object obj) {
		boolean result = true;
		if (obj == null) {
			return false;
		}
		if (obj instanceof String && "".equals(((String) obj).trim())) {
			result = false;
		}
		if (obj instanceof String[] && 0 == ((String[]) (String[]) obj).length) {
			result = false;
		}
		if (obj instanceof Integer[] && 0 == ((Integer[]) (Integer[]) obj).length) {
			result = false;
		}
		if (obj instanceof Map && ((Map<?, ?>) obj).isEmpty()) {
			result = false;
		}
		if (obj instanceof List) {
			if (((List<?>) obj).size() == 0 || ((List<?>) obj).isEmpty()) {
				result = false;
			}
		}
		if (obj instanceof Set) {
			if (((Set<?>) obj).isEmpty() || ((Set<?>) obj).size() == 0) {
				result = false;
			}
		}
		return result;
	}
}
